package com.wlc.mockito;

import com.wlc.service.UserService;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.Spy;
import org.mockito.junit.jupiter.MockitoExtension;

/**
 * @ClassNAME InitMockOrSpyMethod1
 * @Description 初始化mock或者spy 方式 第二种
 * @Author 王立朝
 * @Date 2025/6/1 13:59
 * @Version 1.0
 */
public class InitMockOrSpyMethod2 {

    private UserService mockUserService;
    private UserService spyUserService;

    @BeforeEach
    public void init(){
        mockUserService = Mockito.mock(UserService.class);
        spyUserService = Mockito.spy(UserService.class);
    }
    @Test
    public void test1(){
        System.out.println("isMock:"+Mockito.mockingDetails(mockUserService).isMock());
        System.out.println("isSpy:"+Mockito.mockingDetails(mockUserService).isSpy());

        System.out.println("isMock:" + Mockito.mockingDetails(spyUserService).isMock());
        System.out.println("isSpy:" + Mockito.mockingDetails(spyUserService).isSpy());

    }
}